package com.ccc.ka.controller;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ccc.ka.util.KAResponse;
import org.springframework.web.bind.annotation.*;
import com.ccc.ka.service.IRecordsTypeService;
import com.ccc.ka.entity.RecordsType;
import com.ccc.ka.util.BaseController;

import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @author ccc
 * @since 2023-03-16
 */
@RestController
@RequestMapping("/recordsType")
public class RecordsTypeController extends BaseController {

@Autowired
private IRecordsTypeService recordsTypeService;

@PostMapping("/saveRecordsType")
public KAResponse saveRecordsType(RecordsType recordsType){
    return success(recordsTypeService.save(recordsType));
}

@DeleteMapping("/delRecordsType")
public KAResponse delRecordsType(RecordsType recordsType){
    return success(recordsTypeService.removeById(recordsType));
}

@PutMapping("/updRecordsType")
public KAResponse putRecordsType(RecordsType recordsType){
    return success(recordsTypeService.updateById(recordsType));
}

@GetMapping("/getRecordsType")
public KAResponse getRecordsType(String id){
    return success(recordsTypeService.getById(id));
}

@GetMapping("/getRecordsTypeList")
public KAResponse getRecordsTypeList(RecordsType recordsType){
    return success(recordsTypeService.listByMap(beanToMap(recordsType)));
}

@GetMapping("/getRecordsTypePage")
public KAResponse getRecordsTypePage(Page page, RecordsType recordsType){
    return success(recordsTypeService.getRecordsTypePage(page, recordsType));
}

}
